from langchain_openai import OpenAIEmbeddings
from langchain_community.embeddings import HuggingFaceBgeEmbeddings
import os
from dotenv import load_dotenv
load_dotenv()

class Embeddings:
    def __init__(self) -> None:
        if os.environ["OPENAI_MODEL"] == "Qwen2-0.5B-Instruct":
            self.embed = OpenAIEmbeddings(model=os.environ["OPENAI_MODEL"])
        else:
            self.embed = HuggingFaceBgeEmbeddings(cache_folder="./huggingface/hub",model_name="BAAI/bge-small-zh-v1.5")
    def call(self,input):
        return self.embed.embed_documents(input)

emObj= Embeddings()